

use RP_ESSfile.dta, clear


//Table 1//
logit interest i.GL i.gender agea eduyrs swi i.employ i.rural i.election if fulldata==1 & partner==1 [pw=weight], robust cluster(cntry)

logit voted i.GL i.gender agea eduyrs swi i.employ i.rural i.election if fulldata==1 & partner==1 [pw=weight], robust cluster(cntry)



//Figure 1//
logit interest i.GL i.gender agea eduyrs swi i.employ i.rural i.election if fulldata==1 & partner==1 [pw=weight], robust cluster(cntry)
margins, dydx(*) post
estimates store interest1

logit voted i.GL i.gender agea eduyrs swi i.employ i.rural i.election if fulldata==1 & partner==1 [pw=weight], robust cluster(cntry)
margins, dydx(*) post
estimates store turnout1

coefplot interest1 , drop (_cons *.election) xline(0) rescale(100) levels(95 90) omitted baselevels headings(0.GL = "{bf:Sexuality}" 0.gender = "{bf:Sex}" 1.employ = "{bf:Employment}" 0.rural = "{bf:Rurality}") 


coefplot turnout1 , drop (_cons *.election) xline(0) rescale(100) levels(95 90) omitted baselevels headings(0.GL = "{bf:Sexuality}" 0.gender = "{bf:Sex}" 1.employ = "{bf:Employment}" 0.rural = "{bf:Rurality}") 





//Figure 2//
logit voted i.GL i.gender agea eduyrs swi i.employ i.rural i.election if fulldata==1 & partner==1 [pw=weight], robust cluster(cntry)
margins, dydx(*) post
estimates store full1

logit voted i.GL i.gender agea eduyrs swi i.employ i.election if fulldata==1 & partner==1 [pw=weight], robust cluster(cntry)
margins, dydx(*) post
estimates store nourban1

logit voted i.GL i.gender agea eduyrs swi i.employ i.election if fulldata==1 & partner==1 & rural==0 [pw=weight], robust cluster(cntry)
margins, dydx(*) post
estimates store urban1

logit interested i.GL i.gender agea eduyrs swi i.employ i.rural i.election if fulldata==1 & partner==1 [pw=weight], robust cluster(cntry)
margins, dydx(*) post
estimates store full2

logit interested i.GL i.gender agea eduyrs swi i.employ i.election if fulldata==1 & partner==1 [pw=weight], robust cluster(cntry)
margins, dydx(*) post
estimates store nourban2

logit interested i.GL i.gender agea eduyrs swi i.employ i.election if fulldata==1 & partner==1 & rural==0 [pw=weight], robust cluster(cntry)
margins, dydx(*) post
estimates store urban2


coefplot full2 nourban2 urban2 || full1 nourban1 urban1, keep(*.GL) vertical yline(0, lpattern(dash) lwidth(thick) lcolor(cranberry)) mlabel rescale(100) format(%9.2g) mlabposition(3) mlabgap(*2) ci(95 90) legend(row(1))


///FIGURE 3///


logit contplt i.GL i.gender agea eduyrs swi i.employ i.rural i.election if fulldata==1 & partner==1 [pw=weight], robust cluster(cntry)
estimates store a1
margins, dydx(*) post
estimates store b1

logit wrkprty i.GL i.gender agea eduyrs swi i.employ i.rural i.election if fulldata==1 & partner==1 [pw=weight], robust cluster(cntry)
estimates store a2
margins, dydx(*) post
estimates store b2

logit wrkorg i.GL i.gender agea eduyrs swi i.employ i.rural i.election if fulldata==1 & partner==1 [pw=weight], robust cluster(cntry)
estimates store a3
margins, dydx(*) post
estimates store b3

logit badge i.GL i.gender agea eduyrs swi i.employ i.rural i.election if fulldata==1 & partner==1 [pw=weight], robust cluster(cntry)
estimates store a4
margins, dydx(*) post
estimates store b4

logit sgnptit i.GL i.gender agea eduyrs swi i.employ i.rural i.election if fulldata==1 & partner==1 [pw=weight], robust cluster(cntry)
margins, dydx(*) post
estimates store b5

logit pbldmn i.GL i.gender agea eduyrs swi i.employ i.rural i.election if fulldata==1 & partner==1 [pw=weight], robust cluster(cntry)
margins, dydx(*) post
estimates store b6

logit bctprd i.GL i.gender agea eduyrs swi i.employ i.rural i.election if fulldata==1 & partner==1 [pw=weight], robust cluster(cntry)
estimates store a7
margins, dydx(*) post
estimates store b7

logit mmbprty i.GL i.gender agea eduyrs swi i.employ i.rural i.election if fulldata==1 & partner==1 [pw=weight], robust cluster(cntry)
estimates store a8
margins, dydx(*) post
estimates store b8


coefplot b1 || b2 || b3 || b8 || b6 || b5 || b7 || b4, keep(*.GL) xline(0) mlabel rescale(100) format(%9.2g) mlabposition(2) mlabgap(*2) ci(95 90) byopts(row(4))




//Models without weights

logit interest i.GL i.gender agea eduyrs swi i.employ i.rural i.election if fulldata==1 & partner==1, robust cluster(cntry)
outreg2 using tab_noweights.doc, dec(2) replace

logit voted i.GL i.gender agea eduyrs swi i.employ i.rural i.election if fulldata==1 & partner==1, robust cluster(cntry)
outreg2 using tab_noweights.doc, dec(2) append



//Model demonstrating voters are liberal//


reg lrscale i.GL i.gender agea eduyrs swi i.employ i.rural i.election if fulldata==1 & partner==1 [pw=weight], robust cluster(cntry)
outreg2 using liberaltest.doc, dec(2) append



